import { request } from "@/utils/http";
import { Key } from "react";
import type { UpdateHospitalParams, HospitalSetList, AddHospitalParams, GetHospitalSetListparams, GetHospitalSetListResponse } from "./model/hospitalSettypes";

export const reqGetHospitalSetList = ({ page, limit, hosname, hoscode }: GetHospitalSetListparams) => {
  // <any, string>的第一个类型为any即可，实际不会用上
  // 第二个类型是返回值数据中data的类型，根据接口文档填写
  return request.get<any, GetHospitalSetListResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
    params: {
      hosname,
      hoscode,
    }
  });
};
export const reqAddHospital = (data: AddHospitalParams) => {
  return request.post<any, null>(`/admin/hosp/hospitalSet/save`, data);
};
export const reqGetHospitalById = (id: number) => {
  return request.get<any, HospitalSetList>(`/admin/hosp/hospitalSet/get/${id}`);
};
export const reqUpdataHospital = (data: UpdateHospitalParams) => {
  return request.put<any, null>(`/admin/hosp/hospitalSet/update`, data);
};
export const deleteHospital = (id: number) => {
  return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`);
};
export const reqDeleteHospitalList = (idList: Key[]) => {
  return request.delete<any, null>(`/admin/hosp/hospitalSet/batchRemove`, {data:idList});
};